<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>VUE计算属性-vs-methods</title>
        <script type="text/javascript" src="https://unpkg.com/vue/dist/vue.js"></script>
    </head>
    <body>
        <div id="app">
            <input v-model="message"/><br/>
            <p>{{message}}</p>
            <p>{{reverteMessage}}</p>
            <p>{{reverteMessageMethod()}}</p>
        </div>
    </body>
    <script type="text/javascript">
        var vueObj = new Vue({
            el: '#app',
            data: {
                message: ""
            },
            computed: {
                reverteMessage: function() {
                    console.log("触发了计算属性");
                    return this.message.split(" ").reverse().join(" ");
                }
            },
            methods: {
                reverteMessageMethod: function() {
                    console.log("触发了方法");
                    return this.message.split(" ").reverse().join(" ");
                }
            }
        });
    </script>
</html>